//
//  File.swift
//  ECApp
//
//  Created by ping Cheng on 2017/10/27.
//

import Foundation
import PerfectLib
// 产品类型
class ProductType :JSONConvertibleObject{
    var id = -1
    var name = ""
    
    override func getJSONValues() -> [String : Any] {
        return ["id":id,"categoryName":name]
    }
}
// 产品属性
class ProductProperty :JSONConvertibleObject{
    var id = -1
    var name = ""
    var items = [ProductPropertyItem]()
    override func getJSONValues() -> [String : Any] {
        return ["name":name,"properties":items]
    }
}
// 产品属性的描述项
class ProductPropertyItem :JSONConvertibleObject{
    var id = -1
    var name = ""
   
    override func getJSONValues() -> [String : Any] {
        return ["id":id,"propertyValue":name]
    }
}
// 产品
class Product :JSONConvertibleObject{
    var id = -1
    var productNo = ""
    var name = ""
    var price:Float = 0
    var currency = ""
    var stock = 0
    var unit = ""
    var thumbnailUrl = ""
    var images = [String]()
    
    override func getJSONValues() -> [String : Any] {
        return ["id":id,
                "itemNo":productNo,
                "itemName":name,
                "price":price,
                "currency":currency,
                "stock":stock,
                "unit":unit,
                "thumbnailUrl":thumbnailUrl,
                "imgs":images
        ]
    }
}
